#include <iostream>
#include <irrlicht.h>
#include <string>
#include "CSGLColor.h"

using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

using namespace std;

void CSGLColor::Init(){
	/*SColor * temp;
	temp = new SColor(alpha, 255, 0, 0);
	this->RED = temp;
	delete temp;*/
	this->RED = SColor(alpha, 255, 0, 0);
	this->ORANGE = SColor(alpha, 255, 165, 0);
	this->YELLOW = SColor(alpha, 255, 255, 0);
	this->GREEN = SColor(alpha, 0, 255, 0);
	this->BLUE = SColor(alpha, 0, 0, 255);
	this->DARK_GREEN = SColor(alpha, 0, 100, 0);
	this->PINK = SColor(alpha, 255, 192, 203);
	this->GREY = SColor(alpha, 190, 190, 190);
	this->WHITE = SColor(alpha, 0, 0, 0);
	this->BLACK = SColor(alpha, 0, 0, 0);
}

CSGLColor::~CSGLColor(){
	/*delete this->RED;
	delete this->ORANGE;
	delete this->YELLOW;
	delete this->GREEN;
	delete this->BLUE;
	delete this->DARK_GREEN;
	delete this->PINK;
	delete this->GREY;
	delete this->WHITE;
	delete this->BLACK;*/
}

CSGLColor::CSGLColor(){
	this->alpha = 255;
	Init();
}

CSGLColor::CSGLColor(irr::u32 alpha){
	this->alpha = alpha;
	Init();
}

int CSGLColor::getAlpha(){
	return this->alpha;
}

void CSGLColor::setAlpha(int alpha){
	this->alpha = alpha;
}

SColor CSGLColor::returnColor(stringw color){
	int nColor = -1;
	if (color == "red")
		nColor = 1;
	else if (color == "green")
		nColor = 2;
	else if (color == "blue")
		nColor = 3;
	else if (color == "dark green")
		nColor = 4;
	else if (color == "pink")
		nColor = 5;
	else if (color == "grey")
		nColor = 6;
	switch (nColor){
		case 1:
			return SColor(255, 255, 0, 0);
			break;
		case 2:
			return SColor(255, 0, 255, 0);
			break;
		case 3:
			return SColor(255, 0, 0, 255);
			break;
		case 4:
			return SColor(255, 0, 50, 0);
			break;
		case 5:
			return SColor(255, 255, 10, 255);
			break;
		case 6:
			return SColor(255,200,200,200);
			break;
		default:
			return SColor(255,200,200,200);
			break;
	}// TODO: Make this function modular
}